﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using CoffeeSoft.Contract.Models;

namespace CoffeeSoft.Contract.Services
{
    public interface IServices
    {
        #region Company
        List<CompanyModel> ListCompany();

        CompanyModel SaveOrUpdateCompany(CompanyModel model);

        bool DeleteCompany(CompanyModel model);



        #endregion

        #region Unit
        List<UnitModel> ListUnit();

        UnitModel SaveOrUpdateUnit(UnitModel model);

        bool DeleteUnit(UnitModel model);


        #endregion

        #region Item Type
        List<ItemTypeModel> ListItemType();

        ItemTypeModel SaveOrUpdateItemType(ItemTypeModel model);

        bool DeleteItemType(ItemTypeModel model);


        #endregion

        #region Group User
        List<GroupUserModel> ListGroupUser();

        GroupUserModel SaveOrUpdateGroupUser(GroupUserModel model);

        bool DeleteGroupUser(GroupUserModel model);
        List<GroupUserModel> ListGroupUserWithoutAdministratorGroup();

        #endregion


        #region Item
        List<ItemModel> ListItem();

        ItemModel SaveOrUpdateItem(ItemModel model);

        bool DeleteItem(ItemModel model);

        List<ItemModel> ListItemByWareHouseId(int wareHouseId);

        #endregion

        #region Item Price
        List<ItemPriceModel> ListItemPriceByItemId(int itemId);

        ItemPriceModel SaveOrUpdateItemPrice(ItemPriceModel model);

        bool DeleteItemPrice(ItemPriceModel model);

        bool IsCheckOverLapItemPrice(int itemPriceId, DateTime effectiveFrom, DateTime? effectiveTo, int itemId);

        bool IsHaveCurrentPrice(int itemId);

        ItemPriceModel GetPriceInPast(DateTime dateCreateExport, int itemId);
        #endregion


        #region WareHouse

        List<WareHouseModel> LoadWareHouseSales();

        List<WareHouseModel> ListWareHouse();

        #endregion


        #region Department
        List<DepartmentModel> ListDepartment();

        DepartmentModel SaveOrUpdateDepartment(DepartmentModel model);

        bool DeleteDepartment(DepartmentModel model);


        #endregion

        #region  Employer

        List<EmployerModel> ListEmployer();

        EmployerModel SaveOrUpdateEmployer(EmployerModel model);

        bool DeleteEmployer(EmployerModel model);


        #endregion

      

        #region WareHouse Type
        List<WareHouseTypeModel> ListWareHouseType();

        WareHouseTypeModel SaveOrUpdateWareHouseType(WareHouseTypeModel model);

        bool DeleteWareHouseType(WareHouseTypeModel model);


        #endregion

        #region Item Type


        WareHouseModel SaveOrUpdateWareHouse(WareHouseModel model);

        bool DeleteWareHouse(WareHouseModel model);


        #endregion

      
        #region Security
        /// <summary>
        /// The login with user name and password.
        /// parameter 0 : login succeed or not
        /// parameter 1  : isAdmin or not
        /// parameter 2 : username
        /// parameter 3 : group User ID
        /// </summary>

        UserAccountModel LoginWithUserNameAndPassword(string userName, string password);

        #endregion



        #region Report

       
        #endregion



        #region  UserAccount

        List<UserAccountModel> ListUserAccountWithoutAdministrator();

        UserAccountModel SaveOrUpdateUserAccount(UserAccountModel model, bool isNewAccount);

        bool DeleteUserAccount(UserAccountModel model);

        string ResetPasswordByUserName(string username);

        bool ChangePassword(string username, string oldPass, string newPass);



        #endregion


        #region Permit
        bool DeleteAllRoleByGroupUserId(int groupUserId);

        List<DetailGroupUserRoleModel> GetDetailRoleByGroupUserId(int groupUserId);

        bool SaveListRoleForGroupUser(List<DetailGroupUserRoleModel> listModel);
        bool R(int groupUserId, string roldId);

        #endregion


        #region Area
        List<AreaModel> ListAllArea();

        AreaModel SaveOrUpdateArea(AreaModel model,bool isNew);

        bool DeleteArea(AreaModel model);


        #endregion

        #region Table
        List<TableModel> ListAllTable();

        TableModel SaveOrUpdateTable(TableModel model);

        bool DeleteTable(TableModel model);

        List<TableModel> ListTableHaveGuestByAreaId(string areaId);
        List<TableModel> ListTableNotHaveGuestByAreaId(string areaId);

        #endregion


        #region Export

        List<ExportDetailModel> GetDetailExportByTableId(int tableId);

        bool AddItemToTable(string exportId, int itemId, int quantity);

        string GetExportNumber(int tableId, string employerId);

        int IsTableHaveGuest(int tableId);

        ExportModel GetExportByExportId(string exportId);

        bool UpdateServiceAndVat(ExportModel model);

        bool UpdateDiscountForItem(string exportId, int itemId, decimal itemDiscount);
        bool PaidBill(string expId, DateTime? datePaid);
        List<ExportDetailModel> GetDetailExportByExportId(string exportId);
        List<PrintAgainModel> GetListExport(DateTime from, DateTime to, bool isPayAll);

        bool Backup(string query);

        bool DeleteAllRoleFromDetailByGroupUserId(int groupUserId);
        bool UpdateAndResetRoleForGroupUser(int groupUserId);

        ExportModel SaveOrUpdateExport(ExportModel model);
        #endregion

        #region Export Details
        void UpdateNoteForExportDetailItem(string exportId, int itemId, bool note);

        #endregion

        #region Report

        List<ReportSynthesisModel> ReportSynthesis(DateTime from, DateTime to);
        List<ReportByExportIdModel> ReportByExport(DateTime from, DateTime to);
        List<ReportByDateModel> ReportByDate(DateTime from, DateTime to);
        List<ReportByItemModel> ReportByItem(DateTime from, DateTime to);


        #endregion

        #region KulExchange

        KulExchangeModel GetCurrentKulExchange();

        KulExchangeModel UpdateKulValue(KulExchangeModel model);


        #endregion


        #region MemberType
        List<MemberTypeModel> ListMemberType();

        MemberTypeModel SaveOrUpdateMemberType(MemberTypeModel model, bool IsUpdate);

        bool DeleteMemberType(MemberTypeModel model);


        #endregion


        #region ExportKulExchange
        List<ExportKulExchangeModel> ListExportKulExchange();

        ExportKulExchangeModel SaveOrUpdateExportKulExchange(ExportKulExchangeModel model);

        bool DeleteExportKulExchange(ExportKulExchangeModel model);

        

        #endregion

        #region State
        List<StateModel> ListState();

        StateModel SaveOrUpdateState(StateModel model, bool isUpdate);

        bool DeleteState(StateModel model);


        #endregion

        #region MemberCard
        List<MemberCardModel> ListMemberCard();

        MemberCardModel SaveOrUpdateMemberCard(MemberCardModel model);

        bool DeleteMemberCard(MemberCardModel model);

        bool IsMemberCardNumberExists(string memberCardNumber, int memberCardId);

        bool UpdateStateOfVipCard(string stateId, string memberCardNumber);

        #endregion

        #region Customer
        List<CustomerModel> ListCustomer();

        CustomerModel SaveOrUpdateCustomer(CustomerModel model);

        bool DeleteCustomer(CustomerModel model);
        bool IsMemberCardIsExistCustomer(string memberCardNum);

        CustomerModel GetCustomerByMemberCardNumber(string memberCardNumber);
        int GetKulByTotalExportValue(decimal totalExportValue);

        int GetDiscountMemberByCustomerId(int customerId);

        #endregion

        #region Material
        List<MaterialModel> ListAllMaterial();

        MaterialModel SaveOrUpdateMaterial(MaterialModel model);

        bool DeleteMaterial(MaterialModel model);

     

        #endregion

        #region Import & Import Detail

        string GetImport();

        bool SaveImport(ImportModel model);

        bool SaveImportDetail(List<ImportDetailModel> listModel, ImportModel importModel);

        List<ImportModel> ListAllImport();
        List<ImportDetailModel> ListItemByImportId(string importId);
        bool UpdateQuantityInImported(string importId, int materialId, int newQuantity);
        bool DeleteImportDetailById(string importId, int materialId);

        #endregion
    }
}
